<template>
  <div>
    <div v-for="item in tabs" :key="item.formCode" v-show="item.show">
      <a-card :bordered="false">
        <form-redirect func="add" :formCode="item.formCode"></form-redirect>
      </a-card>
    </div>
  </div>
</template>

<script>

  import FormRedirect from './FormRedirect'

  export default {
    name: 'FormRedirectAddTab',
    components: {
      FormRedirect
    },
    props: {
      formCode: String,
    },
    data () {
      return {
        tabs: []
      }
    },
    methods: {
      reLoad () {
        if (this.formCode) {
          this.tabs = [{
            formCode: this.formCode,
            show: true,
          }]
        } else {
          this.tabs = []
        }
      }
    },
    watch: {
      formCode: {
        handler (value) {
          this.reLoad()
        },
        immediate: true
      }
    }
  }
</script>
